package com.momo.common.core.result;

/**
 * @author : Yu Kebo
 * @date : 2023年04月12日
 */
public enum RsCode {

    /**
     * 返回结果
     */
    SUCCESS(0, "成功"),
    ERROR(-1, "系统繁忙，请稍候再试"),
    TIMEOUT(-2, "请求超时，请稍候再试"),
    EX_PARAM(-4, "参数类型异常"),
    EX_NULL_POINT(-5, "空指针异常"),
    ERROR_CAPTCHA(-6, "验证码校验失败"),
    ERROR_VALID_PARAM(-7, "参数验证失败"),

    BAD_REQUEST(400, "错误的请求"),
    UNAUTHORIZED(401, "Unauthorized，未授权，请求要求身份验证"),
    FORBIDDEN(403, "Forbidden，权限不足，请求被拒绝"),
    NOT_FOUND(404, "没有找到资源"),

    AUTH_BASIC_INVALID(40000, "无效的基本身份验证令牌"),
    AUTH_TOKEN_EXPIRED(40001, "会话超时，请重新登录"),
    AUTH_SIGNATURE(40002, "不合法的token"),
    AUTH_ILLEGAL_ARGUMENT(40003, "缺少token参数"),
    AUTH_GEN_TOKEN_FAIL(40004, "生成token失败"),
    AUTH_PARSER_TOKEN_FAIL(40005, "解析用户身份错误，请重新登录"),
    AUTH_USER_INVALID(40006, "用户名或密码错误"),
    AUTH_USER_ENABLED(40007, "用户已经被禁用"),
    AUTH_OFFLINE(40008, "您已在另一个设备登录");

    private final int value;

    private final String reasonPhrase;


    RsCode(int value, String reasonPhrase) {
        this.value = value;
        this.reasonPhrase = reasonPhrase;
    }


    /**
     * Return the integer value of this status code.
     */
    public int code() {
        return this.value;
    }

    /**
     * Return the reason phrase of this status code.
     */
    public String msg() {
        return this.reasonPhrase;
    }

}
